package com.flowable.controller;

import com.flowable.common.result.CommonResult;
import com.flowable.service.HistoricService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 历史 控制器
 */
@RestController
@RequestMapping("/history")
public class HistoricController {

    @Autowired
    private HistoricService historicService;

    /**
     * 查询 历史流程实例
     *
     * @param processInstanceId 流程实例ID
     * @return
     */
    @GetMapping("/processInstance/query")
    public CommonResult historicProcessInstanceQuery(@RequestParam(value = "processInstanceId") String processInstanceId) {
        return historicService.historicProcessInstanceQuery(processInstanceId);
    }


    /**
     * 查询 历史活动实例
     *
     * @param processInstanceId 流程实例ID
     * @return
     */
    @GetMapping("/activityInstance/query")
    public CommonResult historicActivityInstanceQuery(@RequestParam(value = "processInstanceId") String processInstanceId) {
        return historicService.historicActivityInstanceQuery(processInstanceId);
    }
}
